/*
 * 2004 TCCC online round 4 prob 1
 */

import java.util.*;
import java.util.regex.*;
import java.text.*;
import java.math.*;


public class BadNeighbors
{
    public int maxDonations(int[] donations)
    {
	int N = donations.length;
	if (N == 1)
	    return donations[0];
	int[][] dp = new int[2][N];
	dp[0][0] = donations[0];
	dp[1][1] = donations[1];
	for (int i = 2; i < N; ++i) {
	    if (i != N - 1)
		dp[0][i] = donations[i];
	    dp[1][i] = donations[i];
	    
	    for (int j = i - 2; j >= 0; --j) {
		if (i != N - 1)
		    dp[0][i] = Math.max (dp[0][i], donations[i] + dp[0][j]);
		dp[1][i] = Math.max (dp[1][i], donations[i] + dp[1][j]);
	    }
	}
	
	int max = 0;
	for (int i = 0; i < 2; ++i)
	    for (int j = 0; j < N; ++j)
		max = Math.max (max, dp[i][j]);
	return max;
    }
    
    <%:testing-code%>
}
//Powered by KawigiEdit 2.1.4 (beta) modified by pivanof!